home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 May: Technology Seed / Mac Tech Seed May '97.toast / QuickTime™ VR 2.0 SDK / QTVR C⁄C++ Runtime API / Sample Code / VRShell Sample Code / Common Files / Mac Framework / MacFramework.h < prev    next >
Encoding:
Text File  |  1997-02-21  |  4.3 KB  |  162 lines  |  [TEXT/MPCC]

  1. //
  2. //    File:        MacFramework.h
  3. //
  4. //    Contains:    Basic functions for windows, menus, and similar things.
  5. //
  6. //    Written by:    Tim Monroe
  7. //                Based (heavily!) on the MovieShell code written by Apple DTS
  8. //
  9. //    Copyright:    © 1994-1996 by Apple Computer, Inc., all rights reserved.
  10. //
  11. //    Change History (most recent first):
  12. //
  13. //       <3>         12/05/96    rtm        added movie and instance to WindowObjectRecord
  14. //       <2>         11/27/96    rtm        conversion to personal coding style
  15. //       <1>         12/20/94    khs        first file
  16. //       
  17.  
  18. #pragma once
  19.  
  20. // header files
  21.  
  22. #include "QTVR.h"
  23. #include "Movies.h"
  24. #include <stdio.h>
  25. #include <TextUtils.h>
  26. #include <Memory.h>
  27.  
  28. #ifdef __MWERKS__
  29. #include <sioux.h>
  30. #endif //__MWERKS__
  31.  
  32.  
  33. //////////
  34. // constants
  35. //////////
  36.  
  37. enum {
  38.     kMovieControllerObject  = 'MCvr'
  39. };
  40.  
  41.  
  42. // for menus
  43. enum eMenubar { 
  44.     mMenubar        = 128
  45. };
  46.  
  47. enum eMainMenus {
  48.     mApple            = 128,
  49.     mFile,
  50.     mEdit
  51. };
  52.  
  53. enum  eAppleMenu {
  54.     iAbout            = 1
  55. };
  56.  
  57. enum eFileMenu {
  58.     iNew            = 1,
  59.     iOpen,
  60.     iClose,
  61.     iSave,
  62.     iSaveAs,
  63.     iPrint            = 7,
  64.     iQuit            = 9
  65. };
  66.  
  67. enum eEditMenu {
  68.     iUndo            = 1,
  69.     iCut            = 3,
  70.     iCopy,
  71.     iPaste,
  72.     iClear,
  73.     iSelectAll        = 8
  74. };
  75.  
  76. // for dialogs
  77. enum eDialogs {
  78.     kAboutBox        = 128,
  79.     kAlertError        = 129
  80. };
  81.  
  82.  
  83. //////////
  84. // structures
  85. //////////
  86.  
  87. // WindowObjectRecord is a data structure attached to the movie window.
  88. // Use this structure to associate data with any window presented.
  89.  
  90. typedef struct {
  91.     WindowRef                fWindow;        // the window
  92.     OSType                    fObjectType;    // specific tag indicating that the window object belongs to our application
  93.     Movie                    fMovie;            // the main movie (QT or QTVR)
  94.     MovieController         fController;    // the movie controller for this window
  95.     Rect                    fOriginalSize;    // original size of movie, including controller (currently unused)
  96.     FSSpec                    fFileFSSpec;
  97.     short                    fFileResID;
  98.     short                    fFileRefNum;
  99.     QTVRInstance            fInstance;        // the QTVRInstance
  100.     Handle                    fAppData;        // a handle to application-specific data
  101. } WindowObjectRecord, *WindowObjectPtr, **WindowObject;
  102.  
  103.  
  104. //////////
  105. // function prototypes
  106. //////////
  107.  
  108. // Mac Toolbox functions
  109. void                        InitStack (long extraStackSpace);
  110. void                         InitMacEnvironment (long nMoreMasters);
  111. pascal void                 AppGrowZoneCallback (void);
  112.  
  113. Boolean                     InitMenubar (void);
  114. void                         HandleMenuCommand (long theMenuResult);
  115. void                         AdjustMenus (void);
  116. Boolean                        CheckMovieControllers (EventRecord *theEvent);
  117. void                         MainEventLoop (void);
  118.  
  119. Boolean                     IsAppWindow (WindowRef theWindow);
  120. WindowObject                 CreateWindowObject (WindowRef theWindow);
  121.  
  122. void                         HandleKeyPress (EventRecord *theEvent);
  123. void                         ShowAboutDialogBox (void);
  124. void                         ShowWarning (Str255 theMessage, OSErr theErr);
  125.  
  126. // movie-related Toolbox functions
  127. MovieController              GetMCFromFrontWindow (void);
  128. Handle                        GetAppDataFromFrontWindow (void);
  129. Handle                        GetAppDataFromWindow (WindowRef theWindow);
  130. Handle                        GetAppDataFromWindowObject (WindowObject theWindowObject);
  131. Boolean                     IsWindowObjectOurs (WindowObject theObject);
  132. Boolean                     DoCreateNewMovie (void);
  133. MovieController                SetupMovieWindowWithController (Movie theMovie, WindowRef theWindow);
  134. Boolean                     DoCreateMovieWindow (Movie theMovie);
  135. void                         DoDestroyMovieWindow (WindowRef theWindow);
  136. void                         DoActivateWindow (WindowRef theWindow, Boolean becomingActive);
  137. Boolean                     DoUpdateMovieFile (WindowRef theWindow);
  138.  
  139.  
  140. // application-specific functions
  141. // These are defined in the MacApplication.c file;
  142. // you could override these to change the behavior of the function in a specific application.
  143.  
  144. void                        InitApplication (void);
  145. void                        StopApplication (void);
  146. void                        DoIdle (WindowRef theWindow);
  147. void                        DoUpdateWindow (WindowRef theWindow, Rect *theRefrehArea);
  148. void                         HandleContentClick (WindowRef theWindow, EventRecord *theEvent);
  149. Boolean                        HandleQTVRKeyPress (EventRecord *theEvent);
  150. WindowRef                     CreateMovieWindow (Rect *theRect, Str255 theTitle);
  151. void                        AddControllerFunctionality (MovieController theMC);
  152. void                         HandleApplicationMenu (short theMenuID, short theMenuItem);
  153. void                        AdjustApplicationMenus (void);
  154. WindowObject                GetWindowObjectFromFrontWindow (void);
  155. QTVRInstance                GetQTVRInstanceFromFrontWindow (void);
  156. void                        InitApplicationWindowObject (WindowObject theWindowObject);
  157. void                        RemoveApplicationWindowObject (WindowObject theWindowObject);
  158. pascal Boolean                ApplicationMCActionFilterProc (MovieController theMC, short theAction, void *theParams, WindowRef theWindow);
  159.  
  160.  
  161.  
  162.